<?php 

require_once 'cabecalho.php'; 

$id       = $_GET["id"];
$texto    = DB::find(6,"textos");
$destaque = DB::find(null,"cardapio","destaque=1");
$card     = DB::find($id,"cardapio");
$cardapio = DB::parseSql("SELECT cardapio.id,fotos_cardapio.arquivo,preco,nome,descricao FROM cardapio LEFT JOIN fotos_cardapio ON(cardapio=cardapio.id)"); 

foreach($cardapio as $v){
	$arr_fotos[$v["id"]][] = array("id"=>$v["id"],"arquivo"=>$v["arquivo"]);
	$arr[$v["id"]]         = $v;
}

if($id){
	$titulo  = $card["nome"];
	$texto2  = $card["descricao"];
	$arquivo = $card["arquivo"];
}else{
	$titulo  = "Bagdad Café Recomenda:";
	$texto2  = $destaque["descricao"];
	$arquivo = $destaque["arquivo"];
}
?>
					
	<div class="separator top-separator content left"></div>
	<div class="separator top-separator content right"></div>

	<div id="main" class="content">	
		
		<div class="dmtmenu dmtmenu-category">
		
			<h1>Culinária</h1>
				
			<div class="category-desc clearfix">
				<p><?php echo $texto["texto"]?></p>
			</div>

			<table class="fulltable">
			
				<tr class="dmtmenu-item"><h3>Especialidades</h3>
					
				</tr>
				<?php foreach($arr as $k => $v): ?>
				
					<?php foreach($arr_fotos[$k] as $f): ?>
					<a rel="lightbox[<?php echo $f["id"]; ?>]" href="admin/<?php echo $f["arquivo"]; ?>">
					<?php endforeach; ?>
					
				<tr class="dmtmenu-item">
					<td>
						<h5><span>
						<a rel="lightbox[<?php echo $k; ?>]" href="admin/<?php echo $f["arquivo"]; ?>">
							<img src="images/eye.png" alt="" class="icon" /><?php echo $v["nome"]; ?></a></span></h5>
						<details class="small">
							<p><?php echo $v["descricao"]; ?></p>
						</details>
					</td>
					<td class="dmtmenu-price"></td>
				</tr>
				<?php endforeach; ?>
				
			</table>

		</div>
		
	</div><!-- end main -->

	<div class="sidebar content">

		
		<div class="module">
			<h3><?php echo $titulo; ?></h3>
			<p><a class="thumbnail" href="admin/<?php echo $arquivo; ?>" rel="lightbox[destaque]" title="Prato Bagdad">
				<img class="caption left" src="admin/<?php echo $arquivo; ?>" border="0" title="Prato Bagdad" width="165" height="109" /></a>
				<?php echo $texto2; ?>
			</p>
		</div>
		
	</div><!-- end sidebar -->
				

<?php require_once 'rodape.php'; ?>